package org.soul.mgwt.client.widget;

import org.soul.mgwt.client.res.HasCustomStyles;

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HasName;
import com.googlecode.mgwt.ui.client.widget.MTextBox;

public class CsMTextBox extends MTextBox implements HasCustomStyles,HasName{
	
	private String textColor = null;
	private String textWeight = null;
	private String fontSize = null;
	private String fontStyle = null;

	@Override
	public void setTextColor(String color) {
		this.textColor = color;
		for ( int i = 0; i < DOM.getChildCount(getElement()) ; i++){
			
			Element e = DOM.getChild(getElement(), i);
			if ( e.getNodeName().equals("INPUT"))
				e.setAttribute("textColor", color);
		}
	}

	@Override
	public String getTextColor() {
		return textColor;
	}

	@Override
	public void setTextWeight(String weight) {
		this.textWeight = weight;
		for ( int i = 0; i < DOM.getChildCount(getElement()) ; i++){
			
			Element e = DOM.getChild(getElement(), i);
			if ( e.getNodeName().equals("INPUT"))
				e.setAttribute("textWeight", weight);
		}

	}

	@Override
	public String getTextWeight() {
		return textWeight;
	}

	@Override
	public void setFontSize(String fontSize) {
		this.fontSize = fontSize;
		for ( int i = 0; i < DOM.getChildCount(getElement()) ; i++){
			
			Element e = DOM.getChild(getElement(), i);
			if ( e.getNodeName().equals("INPUT"))
				e.setAttribute("fontSize", fontSize);
		}
		
	}

	@Override
	public String getFontSize() {
		return fontSize;
	}

	@Override
	public void setFontStyle(String fontStyle) {
		this.fontStyle = fontStyle;
		for ( int i = 0; i < DOM.getChildCount(getElement()) ; i++){
			
			Element e = DOM.getChild(getElement(), i);
			if ( e.getNodeName().equals("INPUT"))
				e.setAttribute("fontStyle", fontStyle);
		}
		
	}

	@Override
	public String getFontStyle() {
		return fontStyle;
	}
	

	@Override
	public void setRedText(boolean value) {
	}

	
}
